<!--
 * @Author: 闫聪敏
 * @Email: 
 * @Date: 2020-03-05 11:24:11
 * @Descripttion: 
 -->
<div class="table-container" style="clear: both;"><!--  margin-top: 64px; -->
    <nz-table #basicTable [nzData]="listData" nzFrontPagination="false" [nzBordered]="true" nzTitle="ERP库区列表" nzSize="small" >
        <thead>
            <tr>
                <th>ERP库区编号</th>
                <th>ERP库区名称</th>
                <th>MRP库区名称</th>
                <th nzAlign="center">操作</th>
            </tr>
        </thead>
        <tbody>
            <tr *ngFor="let data of basicTable.data">
                <td>{{ data.code }}</td>
                <td>{{ data.name }}</td>
                <td>
                    <ng-container *ngFor="let item of data.warehouseAreas">
                        {{ item.name }}，
                    </ng-container>
                </td>
                <td nzAlign="center">
                    <button nz-button nzType="primary" (click)="showModal(data)" [disabled]="mrpHouse.length === 0"
                        style="margin-bottom: 4px;" *ngIf="bornRole.add">关联</button>
                    <button nz-button nzType="danger" (click)="delete(data)" [disabled]="mrpHouse.length === 0" *ngIf="bornRole.del">删除</button>
                </td>
            </tr>
        </tbody>
    </nz-table>
</div>
<div nz-row class="page_box" style="margin-top: 20px;">
    <nz-pagination (nzPageIndexChange)="listPageChange($event)" [nzPageIndex]="pageIndex" [nzTotal]="listCount"
        [nzPageSize]="pageSize" [nzShowTotal]="totalTemplate"></nz-pagination>
    <ng-template #totalTemplate let-total> 总共 {{ listCount }} 条 </ng-template>
</div>
<nz-modal appDragModal class="hmodal" [(nzVisible)]="isShow" nzTitle="关联库区" [nzFooter]="null" (nzOnCancel)="handleCancel()">
    <form nz-form [formGroup]="detailForm" (ngSubmit)="submitForm()">
        <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>ERP库区</nz-form-label>
            <nz-form-control [nzSm]="14" [nzXs]="24">
                <input nz-input id="code" disabled [value]="selectItem.name" />
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>MRP库区</nz-form-label>
            <nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="请选择MRP库房">
                <nz-select nzDropdownClassName="select_custom" nzPlaceHolder="请选择" formControlName="warehouseId">
                    <nz-option-group [nzLabel]="item.name" *ngFor="let item of selectMrpData">
                        <nz-option *ngFor="let $item of item.warehouseAreas" [nzValue]="$item.id" [nzLabel]="$item.name"></nz-option>
                    </nz-option-group>
                </nz-select>
            </nz-form-control>
        </nz-form-item>
        <div nz-row class="custome_modal_footer">
            <div nz-col nzSpan="24" style="text-align: right;">
                <button nz-button type="button" nzType="default" (click)="handleCancel()">取消</button>
                <button nz-button nzType="primary" [nzLoading]="isLoading">确定</button>
            </div>
        </div>
    </form>
</nz-modal>